<div id="users">
    <? echo $adminMenu->users(); ?>
    <h2><?php __('Users administration');?> (<? echo $html->link(__('new user',true),array('action'=>'add')) ?>)</h2>
    <? echo $form -> create(array('Action'=>'delete_users')); ?>

    <table cellpadding="3" cellspacing="1" width="100%">
        <tr>
            <td width="7%"></td>
            <td></td>
            <td width="10%"></td>
            <td width="10%"></td>
            <td width="10%"></td>
            <td width="10%"></td>
            <td width="10%"></td>
        </tr>
        <tr class="table_head">
            <td colspan="3" class="first-top">
                <? echo $pagination -> create(null,'users'); ?>
            </td>
            <td colspan="4" class="last-top">
                <? __('Sort by'); ?>: <?php echo $paginator->sort(__('Login',true),'username');?> <?php echo $paginator->sort(__('Username',true),'name');?>
            </td>
        </tr>
        <tr>
            <th><? __('Action'); ?></th>
            <th><? __('Username'); ?></th>
            <th><? __('Login'); ?></th>
            <th><? __('Articles'); ?></th>
            <th><? __('News'); ?></th>
            <th><? __('Comments'); ?></th>
            <th><? __('Delete'); ?> <input type="checkbox" onclick="checkAll(this,'UserDeleteUsersForm')"/></th>
        </tr>
        <?php
        $i = 0;
        foreach ($users as $user):
            $class = null;
            if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
            }
            ?>
        <tr<?php echo $class;?>>
            <td>
                    <? echo $html->link($html->image('edit.png',array('alt'=>__('Edit', true))),array('action'=>'edit', $user['User']['id']),array('title'=>__('Edit',true)),null,false); ?>
                    <? echo $html->link($html->image('bin.png',array('alt'=>__('Delete', true))), array('action'=>'delete', $user['User']['id']),array('title'=>__('Delete',true)), __('Delete item', true).' #' . $user['User']['name'],false); ?>
                    <? echo $html->link($html->image('key.png',array('alt'=>__('Change password', true))), array('action'=>'change_password', $user['User']['id']),array('title'=>__('Change password',true)),null,false); ?>
            </td>
            <td>
                    <?php echo $html->link($user['User']['name'],array('Action'=>'edit',$user['User']['id'])); ?>
            </td>
            <td>
                    <?php echo $user['User']['username']; ?>
            </td>
            <td>
                    <?php echo count($user['Article']);?>
            </td>
            <td>
                    <?php echo count($user['News']); ?>
            </td>
            <td>
                    <?php echo count($user['Comment']); ?>
            </td>
            <td  align="center">
                <input type="checkbox" name="data[UsersDelete][]" value="<? echo $user['User']['id']; ?>"/>
            </td>
        </tr>
        <?php endforeach; ?>
        <tr class="table_head">
            <td colspan="3" class="first-bottom">
                <? echo $pagination -> create(null,'users'); ?>
            </td>
            <td colspan="4" class="last-bottom">
                <? __('Sort by'); ?>: <?php echo $paginator->sort(__('Login',true),'username');?> <?php echo $paginator->sort(__('Username',true),'name');?>
            </td>
        </tr>
    </table>
    <div style="float: right; margin: 1em;"><? echo $form -> submit(__('Delete',true)); ?></div>
</form>
</div>